<me:UIAM05 x:Class="WPFExcelReport.TAMMODUL"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls"
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL"  
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                     xmlns:DR="clr-namespace:WPFExcelReport;assembly=TDRAUFTR"  
                    xmlns:AM="clr-namespace:WPFExcelReport;assembly=TAMSTAMM" 
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    x:Name="TV"
                    Loaded="Window_Loaded"
     >
    <me:UIAM05.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:NOTBoolToVisibilityConverter  x:Key="nbv"/>
        <ucd:NOTConverter x:Key="not"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:Divideby1000  x:Key="d1000"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIAM05.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"  >
            <WrapPanel Visibility="Collapsed">
                <Button Click="ResetSeq" Content="{Binding Source={Localization:Translate Word=重置序列号}}"
                    Visibility="{Binding IsITX,Converter={StaticResource bv}}"/>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top"  Visibility="Collapsed"
                      >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <DR:TDRAUFTR  Grid.Column="0" Name="cDR" DocType="{Binding PRTYPE,ElementName=TV}" PrintType="OpenExcel" />
                    <Button  Grid.Column="1"   Click="btnPrint_Click" Height="20" Margin="5,0,0,0" Width="Auto" Content="{Binding Source={Localization:Translate Word=打印确认函}}" />
                </Grid>
                <WrapPanel>
                    <TextBlock  Text="{Binding Source={Localization:Translate Word=设备}}"/>
                    <TextBlock  Text="{Binding KRS,ElementName=TV}" Width="30" />
                    <TextBlock  Text="{Binding LFD,ElementName=TV}" KeyUp="Query_KeyUp" Width="60" />
                    <TextBlock  Text="{Binding POS,ElementName=TV}" KeyUp="Query_KeyUp" Width="30" />
                </WrapPanel>
                <Button Grid.Column="0"  Click="QueryCommand" Height="20" Margin="5,0,0,0" Width="24" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                    </Button.Background>
                </Button>
            </WrapPanel>

            <WrapPanel   >
                <Grid Margin="10,0,0,0" VerticalAlignment="Top" IsEnabled="{Binding IsCanChg,ElementName=TV}" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource nbv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button  Click="EditCommand" Width="24" Height="20">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Edit.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Grid Margin="10,0,0,0" VerticalAlignment="Top"  
                      Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <Button   Click="SaveCommand" Height="20" Margin="5,0,0,0" Width="24" >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Save.png" />
                        </Button.Background>
                    </Button>
                </Grid>
                <Button Click="DeleteCommand" Height="20" Margin="10,0,0,0" Width="24" IsEnabled="{Binding IsCanDelete,ElementName=TV}">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                    </Button.Background>
                </Button>
                <Button Click="CopyCommand" Height="20" Margin="10,0,0,0" Width="24" IsEnabled="{Binding IsCanCopy,ElementName=TV}">
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                    </Button.Background>
                </Button>
                <TextBlock Text="{Binding Source={Localization:Translate Word=同类型}}"/>
               
                <WrapPanel>
                    <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24"
                            IsEnabled="{Binding IsCanNew,ElementName=TV}"
                            >
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                    <WrapPanel IsEnabled="{Binding IsNew,ElementName=TV}">
                        <TextBlock  Text="{Binding Source={Localization:Translate Word=个数:}}"/>
                        <ex:NumericBox  Text="{Binding UPOS,ElementName=TV}" Width="40"/>
                        <WrapPanel >
                            <TextBlock  Text="{Binding Source={Localization:Translate Word=编号:}}"/>
                            <ex:TXT72 Grid.Column="1" FontSize="16" MaxLength="3"   IsAutoClear="True" 
                          PRE="000"  CharacterCasing="Upper" Text="{Binding ART,ElementName=TV}" Width="40" />
                            <Button Grid.Column="0"  Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" >
                                <Button.Background>
                                    <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                                </Button.Background>
                            </Button>
                        </WrapPanel>
                    </WrapPanel>
                   
                </WrapPanel>
            </WrapPanel>
            <WrapPanel>
                <TextBlock  Text="{Binding Source={Localization:Translate Word=模块:}}"/>
                <TextBlock  Text="{Binding AMMMODNR}" Width="24" />
                <TextBlock  Text="{Binding Source={Localization:Translate Word=说明:}}"/>
                <ex:TXT72  Text="{Binding AMMBEZ,Converter={StaticResource gb2312}}"
                               IsReadOnly="{Binding IsEdit,ElementName=TV,Converter={StaticResource not}}"
                               MaxLength="40"
                               Width="100" />
            </WrapPanel>
        </StackPanel>
        <ListBox     Grid.Row="1"  Grid.Column="0" 
            ItemsSource="{Binding Source={StaticResource ResourceKey=vwMaster}}"  
                                ScrollViewer.CanContentScroll="True">
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel  MaxWidth="600"/>
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Width="100">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition  Width="Auto" />
                            <ColumnDefinition  Width="Auto" />
                            <ColumnDefinition Width="1*"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" Text="{Binding Path=AMMMODNR}"/>
                        <TextBlock Grid.Column="1" Text="{Binding Source={Localization:Translate Word=:}}"/>
                        <TextBlock Grid.Column="2" Text="{Binding Path=AMMBEZ,Converter={StaticResource gb2312}}"/>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox> 
    </Grid>
</me:UIAM05>
